﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 信息记录系统
{
    public partial class Form11 : Form
    {
        public Form11()
        {
            InitializeComponent();
        }
        private void word打印ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            //word打印
            word print = new word();
            print.StartPosition = FormStartPosition.CenterScreen;//居中显示
            print.ShowDialog();//禁止操作
        }
        //定义接受数据的变量
        DataRow datarow;

        //定义有参的构造函数
        public Form11(DataRow row)
        {
            InitializeComponent();

            //获取数据

            datarow = row;
        }
        private void Form11_Load(object sender, EventArgs e)
        {
            textBox1.Text = DR2Str(datarow,"customername");//获取数据到textbox中
            textBox2.Text = DR2Str(datarow,"serviceaddress");
            textBox3.Text = DR2Str(datarow,"businessname");
            textBox4.Text = DR2Str(datarow,"systemversion");
            textBox5.Text = DR2Str(datarow,"webversion");
            textBox6.Text = DR2Str(datarow,"servicename");
            textBox7.Text = DR2Str(datarow,"webname");
            textBox8.Text = DR2Str(datarow,"webpath");
            textBox9.Text = DR2Str(datarow,"servicepurpose");
            textBox10.Text = DR2Str(datarow,"webport");
            textBox11.Text = DR2Str(datarow,"langues");
            textBox12.Text = DR2Str(datarow,"nykeep");
            textBox13.Text = DR2Str(datarow,"sqltype");
            textBox14.Text = DR2Str(datarow,"sqlpath");
            textBox15.Text = DR2Str(datarow,"protect");
            textBox16.Text = DR2Str(datarow,"sqlport");
            textBox17.Text = DR2Str(datarow,"servicestime");
            textBox18.Text = DR2Str(datarow,"nowhy");
            textBox19.Text = DR2Str(datarow,"stautimes");
            textBox20.Text = DR2Str(datarow,"clostimes");
            textBox21.Text = DR2Str(datarow,"uppertimes");
            textBox22.Text = DR2Str(datarow,"datapasswd");
            textBox23.Text = DR2Str(datarow, "notie");
        }

        private string DR2Str(DataRow dr, string cn)
        {
            try
            {
                return dr[cn].ToString();
            }
            catch
            {
                return string.Empty;
            }
        }
    }
}
